<?php
// include function files for this application
require_once('/home/domains/uny-con.com/public_html/uny-con_fns.php');
// start session which may be needed later
// start it now because it must go before headers
if(!session_id()) { session_start(); }

//We don't want people accessing this page during the con.
if (!check_valid_user() || ($_SESSION['admin'] != 't')) {
	do_html_header('Unauthorized access', staysmall, $uny);
	echo 'We are sorry, This page is inaccesibe during the con. Please see the registration desk for assistance registering.';
	print_brs(6);
	do_html_footer(news);
	exit;
	}


//get some variables
@ $new = $_POST['new'];

if ($new) {
	//new item selected
	if(!isset($_SESSION['cart'])) {
		$_SESSION['cart'] = array();
		$_SESSION['items'] = 0;
		$_SESSION['total_price'] = '0.00';
		}
	$_SESSION['cart'][$new] = 1;
	$_SESSION['total_price'] = calculate_price($_SESSION['cart']);
	$_SESSION['items'] = calculate_items($_SESSION['cart']);
	}
if(isset($_SESSION['save'])) {
	foreach ($_SESSION['cart'] as $event_id => $qty {
		if($_POST[event_id] == '0')
			unset($_SESSION['cart'][$event_id]);
		else
			$_SESSION['cart'][$event_id] = $_POST[$event_id]
		}
	$_SESSION['total_price'] =calculate_price($_SESSION['cart']);
	$_SESSION['items'] = calculate_items($_SESSION['cart'];
	}

do_html_header('Your Shopping Cart', gobig);

if($_SESSION['cart'] && array_count_values($_SESSION['cart']))
	display_cart($_SESSION['cart'];
else {
	echo '<p>There are no items in your cart</p>';
	echo '<hr />';
	}

echo '<a href="checkout.php"><img src="images/check-out.gif" alt="Go to Checkout" border="0" width="140" height="40"></a>';
           
echo '<a href="http://loki.local/~plummer/uny-con/registration/event_list.php">Sign up for more events</a>';
echo '<a href="http://loki.local/~plummer/uny-con/registration/attendee_home.php">View Schedule</a>';

print_brs(6);
do_html_footer(no_news);

?>